package com.example.reader.mapper;
import com.example.reader.entity.Comment;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface CommentMapper {

    @Select("select count(*) from comment where module = #{module} and fid = #{fid}")
    Integer selectCount(@Param("module") String module, @Param("fid") Integer fid);
    List<Comment> selectByModuleAndFid(@Param("module") String module, @Param("fid") Integer fid);

    List<Comment> selectAll(Comment comment);


    List<Comment> selectByRootId(Integer rootId);

    int insert(Comment comment);

    int updateById(Comment comment);

    int deleteById(Integer id);

    int deleteByPid(Integer pid);

    int deleteByRootId(Integer rootId);

    List<Comment> selectByPid(Integer pid);


    Comment selectById(Integer id);
    Comment newcomment(Comment comment);
}
